﻿namespace @(Model.Namespace).Application
{
    /// <summary>
    /// @(Model.CnName)应用层
    ///</summary>
    public class @(Model.Name)Application : BaseApplication, I@(Model.Name)Application
    {
        /// <summary>
        /// @(Model.CnName)数据访问层
        /// </summary>
        public I@(Model.Name)DAL @(Model.Name)DAL { get; set; }
        
        /// <summary>
        /// 获取@(Model.CnName)分页结果
        ///</summary>
        public async Task<PageResult<Get@(Model.Name)PageResultOutput>> GetPageResultAsync(Get@(Model.Name)PageResultInput input)
        {
            return await @(Model.Name)DAL.GetPageResultAsync(input);
        }

        /// <summary>
        /// 获取@(Model.CnName)分页列表
        ///</summary>
        public async Task<List<Get@(Model.Name)PageListOutput>> GetPageListAsync(Get@(Model.Name)PageListInput input)
        {
            return await @(Model.Name)DAL.GetPageListAsync(input);
        }

        /// <summary>
        /// 获取@(Model.CnName)
        /// </summary>
        @if (Model.IsGuidKey)
        {<text>
        public async Task<Get@(Model.Name)Output> GetAsync(BaseGuidEntity input)</text>}
            else
            {<text>
        public async Task<Get@(Model.Name)Output> GetAsync(BaseKeyEntity input)</text>}
        {
            return await @(Model.Name)DAL.GetAsync(input);
        }

        /// <summary>
        /// 获取全部@(Model.CnName)
        /// </summary>
        public async Task<List<Get@(Model.Name)ItemOutput>> GetAllListAsync()
        {
            return await @(Model.Name)DAL.GetAllListAsync();
        }

        /// <summary>
        /// 修改@(Model.CnName)
        /// </summary>
        public async Task UpdateAsync(Update@(Model.Name)Input input)
        {
            await @(Model.Name)DAL.UpdateAsync(input);
        }

        /// <summary>
        /// 新增@(Model.CnName)
        /// </summary>
        public async Task AddAsync(Add@(Model.Name)Input input)
        {
            await @(Model.Name)DAL.AddAsync(input);
        }

        /// <summary>
        /// 删除@(Model.CnName)
        /// </summary>
    @if (Model.IsGuidKey)
    {<text>
        public async Task DeleteAsync(BaseGuidListInput input)</text>}
            else
            { <text>
        public async Task DeleteAsync(BaseIdListInput input)</text>}
        {
            await @(Model.Name)DAL.DeleteAsync(input);
        }
    }
}